<?php

/**
 * planning_charge form base class.
 *
 * @method planning_charge getObject() Returns the current form's model object
 *
 * @package    gesp
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class Baseplanning_chargeForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'plnchg_id'               => new sfWidgetFormInputHidden(),
      'plnchg_prj_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('projet'), 'add_empty' => false)),
      'plnchg_plntac_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('tache_planning'), 'add_empty' => false)),
      'plnchg_user_id'          => new sfWidgetFormInputText(),
      'plnchg_date'             => new sfWidgetFormDate(),
      'plnchg_charge_prevue'    => new sfWidgetFormInputText(),
      'plnchg_charge_consommee' => new sfWidgetFormInputText(),
      'plnchg_charge_restante'  => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'plnchg_id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('plnchg_id')), 'empty_value' => $this->getObject()->get('plnchg_id'), 'required' => false)),
      'plnchg_prj_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('projet'))),
      'plnchg_plntac_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('tache_planning'))),
      'plnchg_user_id'          => new sfValidatorInteger(array('required' => false)),
      'plnchg_date'             => new sfValidatorDate(array('required' => false)),
      'plnchg_charge_prevue'    => new sfValidatorNumber(array('required' => false)),
      'plnchg_charge_consommee' => new sfValidatorNumber(array('required' => false)),
      'plnchg_charge_restante'  => new sfValidatorNumber(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('planning_charge[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'planning_charge';
  }

}
